# coding: utf-8
import yagmail

from ..config import pytest_config


def send_email(contents):
    yag = yagmail.SMTP(
        user=pytest_config.email_setting.smtp_user,
        password=pytest_config.email_setting.smtp_password,
        host=pytest_config.email_setting.smtp_host,
        port=pytest_config.email_setting.smtp_port,
        smtp_ssl=pytest_config.email_setting.smtp_ssl,
    )
    yag.send(
        to=pytest_config.email_setting.receiver,
        subject=f'{pytest_config.auto_test_setting.project_name}测试报告',
        contents=contents
    )
